﻿<UserControl x:Class="Chapters.Chapter09.DifferentEffects"
			 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
			 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
	<UserControl.Resources>
		<LinearGradientBrush x:Key="HilightBrush"
							 StartPoint="0,0"
							 EndPoint="0,1">
			<GradientStop Offset="0"
						  Color="#3FFFFFFF" />
			<GradientStop Offset="0.5"
						  Color="#3FFFFFFF" />
			<GradientStop Offset="0.5"
						  Color="Transparent" />
			<GradientStop Offset="1"
						  Color="Transparent" />
		</LinearGradientBrush>

		<LinearGradientBrush x:Key="ReflectionBrush"
							 StartPoint="0,0"
							 EndPoint="0,1">
			<LinearGradientBrush.GradientStops>
				<GradientStop Offset="0"
							  Color="#7FFFFFFF" />
				<GradientStop Offset=".5"
							  Color="Transparent" />
				<GradientStop Offset="1"
							  Color="Transparent" />
			</LinearGradientBrush.GradientStops>
		</LinearGradientBrush>

		<ImageBrush x:Key="SoftEdgeBrush"
					ImageSource="/Resources;component/Chapter09/SoftEdgeMask.png" />

	</UserControl.Resources>
	<UniformGrid>
		<Grid Width="232"
			  Height="290">
			<Grid.RowDefinitions>
				<RowDefinition />
				<RowDefinition />
			</Grid.RowDefinitions>

			<Image x:Name="ElementVisual"
				   Source="/Resources;component/Chapter09/battery.png"
				   Stretch="Fill"
				   Grid.Row="0" />
			<Rectangle OpacityMask="{StaticResource ReflectionBrush}"
					   Grid.Row="1"
					   Width="{Binding ActualWidth, ElementName=ElementVisual}"
					   Height="{Binding ActualHeight, ElementName=ElementVisual}">
				<Rectangle.Fill>
					<VisualBrush Visual="{Binding ElementName=ElementVisual}">
						<VisualBrush.RelativeTransform>
							<ScaleTransform ScaleX="1"
											ScaleY="-1"
											CenterX="0.5"
											CenterY="0.5" />
						</VisualBrush.RelativeTransform>
					</VisualBrush>
				</Rectangle.Fill>
			</Rectangle>

		</Grid>

		<Image Source="/Resources;component/Chapter09/battery.png"
			   Stretch="Uniform"
			   Width="232">
			<Image.Effect>
				<DropShadowEffect BlurRadius="15"
								  ShadowDepth="5"
								  Opacity="0.75" />
			</Image.Effect>
		</Image>

		<Rectangle Fill="IndianRed"
				   Width="200"
				   Height="200"
				   StrokeThickness="2"
				   Stroke="Black"
				   OpacityMask="{StaticResource SoftEdgeBrush}" />

		<Grid Width="200"
			  Height="80">
			<Border BorderBrush="#AF000000"
					BorderThickness="3"
					CornerRadius="30">
				<Border.Background>
					<LinearGradientBrush StartPoint="0,0"
										 EndPoint="0,1">
						<GradientStop Offset="0"
									  Color="Black" />
						<GradientStop Offset="1"
									  Color="Red" />
					</LinearGradientBrush>

				</Border.Background>

			</Border>
			<Border Background="{StaticResource HilightBrush}"
					BorderThickness="0"
					CornerRadius="30"
					Margin="3" />
		</Grid>
	</UniformGrid>
</UserControl>
